package sceneGraph;

import javax.vecmath.*;

public class Player extends AbstractPlanetObject implements ISceneObject {
	private float initDistance;

	public Player(float radius, Color3f kDiffuse, Color3f kSpecular, Color3f kAmbient, float nShineness) {
		super(new Point3f(0, 0, 1), radius, kDiffuse, kSpecular, kAmbient, nShineness);
	}

	public Player(float radius, String meshFilename, float meshScale, Color3f kDiffuse, Color3f kSpecular, Color3f kAmbient, float nShineness) {
		super(new Point3f(0, 0, 1), radius, meshFilename, meshScale, kDiffuse, kSpecular, kAmbient, nShineness);
	}

	@Override
	public void accept(Visitor visitor) {
		visitor.visit(this);
	}

	public void moveTo(Point3f newPos, Vector3f newUpDirection) {
		setVectors(newPos, newUpDirection, leftDirection);
	}

	public void setInitDistance(float distance) {
		initDistance = distance;
	}

	public float getInitDistance() {
		return initDistance;
	}

	public void turnRight() {
		Vector3f newLeftDirection = new Vector3f(leftDirection);
		newLeftDirection.scaleAdd(8f, direction);

		setVectors(pos, upDirection, newLeftDirection);
	}

	public void turnLeft() {
		Vector3f oppDirection = new Vector3f(direction);
		oppDirection.scale(-1);

		Vector3f newLeftDirection = new Vector3f(leftDirection);
		newLeftDirection.scaleAdd(8f, oppDirection);

		setVectors(pos, upDirection, newLeftDirection);
	}
}
